home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-06 / an108x.zip / EXIST.C < prev    next >
Text File  |  1991-07-09  |  3KB  |  114 lines

  1. /*****************************************************************************
  2. * Project:
  3. * File:        EXIST.C
  4. * Authors:    Morgan Adair & Matt Hagen, Novell, Inc.
  5. * Date:        91-06-25
  6. *****************************************************************************/
  7.  
  8. #include <stdio.h>
  9. #include <nit.h>
  10. #include <niterror.h>
  11. #include <nxt.h>
  12. #include <diag.h>
  13. #include <dos.h>
  14.  
  15. /*****************************************************************************
  16. * main
  17. *****************************************************************************/
  18.  
  19. void main(void)
  20. {
  21.     BYTE        componentList[54];
  22.     BeginDiagnosticStruct    networkAddress;
  23.     int        connection;
  24.     int        component;
  25.     AllResponseData    response;
  26.     IPXSPXVersion    responseData;
  27.     int        ccode;
  28.     WORD        connectionNum;
  29.     WORD        connectionID;
  30.     union REGS    regs;
  31.     struct SREGS    sregs;
  32.     char        serverName[48];
  33.     BYTE        majorVer, minorVer, revLevel;
  34.     char        name[48];
  35.  
  36. /* Communication Protocols */
  37. /* IPX/SPX present */
  38.  
  39.     if (IPXInitialize() == IPX_NOT_INSTALLED)
  40.         printf("IPX is NOT loaded.\n");
  41.     else {
  42.         printf("IPX IS loaded.\n");
  43.  
  44.         if (SPXInitialize(NULL, NULL, NULL, NULL) == SPX_NOT_INSTALLED)
  45.             printf("SPX is NOT loaded.\n");
  46.         else
  47.             printf("SPX IS loaded.\n");
  48.  
  49. /* IPX/SPX Version */
  50.  
  51.         IPXGetInternetworkAddress((BYTE *)&networkAddress);
  52.         if (BeginDiagnostics(&networkAddress, &connectionID, componentList) != SUCCESSFUL)
  53.             printf("Unable to get IPX/SPX versions\n");
  54.         else {
  55.             component = FindComponentOffset(componentList, IPX_SPX_COMPONENT);
  56.             if (component == -1)
  57.                 printf("Unable to get IPX/SPX versions\n");
  58.                 if (GetIPXSPXVersion(connectionID, component, &response, &responseData) != SUCCESSFUL)
  59.                     printf("Unable to get IPX/SPX versions\n");
  60.                 else {
  61.                     printf("IPX Version: %d.%02d\n", responseData.IPXMajorVersion, responseData.IPXMinorVersion);
  62.                     printf("SPX Version: %d.%02d\n", responseData.SPXMajorVersion, responseData.SPXMinorVersion);
  63.                 }
  64.         }
  65.         EndDiagnostics(connectionID);
  66.     }
  67.  
  68. /* NetWare DOS Shell */
  69.  
  70.     connectionID = GetDefaultConnectionID();
  71.  
  72.     if (connectionID == NULL) {
  73.         printf("The shell is NOT loaded.\n");
  74.         /* if shell is not loaded,
  75.            there is nothing left to live for */
  76.         return;
  77.     } else {
  78.         printf("The shell IS loaded.\n");
  79.         ccode = GetNetWareShellVersion(&majorVer, &minorVer, &revLevel);
  80.         printf("Shell Version: %d.%d, Rev %c\n", majorVer, minorVer, revLevel+'A');
  81.     }
  82.  
  83. /* NetBIOS */
  84.  
  85.     regs.h.ah = 0x35;    /* AH = Interrupt 21h Funtion 35h--
  86.                     Get Interrupt Vector */
  87.     regs.h.al = 0x5C;    /* AL = Interrupt vector to get */
  88.     intdosx(®s, ®s, &sregs);
  89.     switch (sregs.es) {
  90.         /* ES returns segment of pointer to ISR */
  91.         case 0x0000  :
  92.         case 0xF000  : printf("NetBIOS is NOT loaded.\n");
  93.                    break;
  94.         default      : printf("NetBIOS IS loaded.\n");
  95.     }
  96.  
  97.  
  98. /* Connection Information */
  99.  
  100.     for (connection=1; connection<=8; connection++) {
  101.         if (IsConnectionIDInUse(connection) == 1) {
  102.             SetPreferredConnectionID(connection);
  103.             connectionNum = GetConnectionNumber();
  104.             ccode = GetConnectionInformation(connectionNum, name, NULL, NULL, NULL);
  105.             if (ccode == 0) {
  106.                 GetFileServerName(connection, serverName);
  107.                 printf("Connection ID %d is logged in to %s as %s.\n", connection, serverName, name);
  108.             } else
  109.                 printf("Connection ID %d is attached only.\n", connection);
  110.         } else
  111.             printf("Connection ID %d is unused.\n", connection);
  112.     }
  113. }
  114.